﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using GongSolutions.Wpf.DragDrop;

namespace WpfApp1.Views;

public partial class TestGoneDragDropView : Window, IDragSource
{
    public TestGoneDragDropView()
    {
        InitializeComponent();
    }

    public bool CanStartDrag(IDragInfo dragInfo) => GongSolutions.Wpf.DragDrop.DragDrop.DefaultDragHandler.CanStartDrag(dragInfo);

    public void DragCancelled() => GongSolutions.Wpf.DragDrop.DragDrop.DefaultDragHandler.DragCancelled();

    public void DragDropOperationFinished(DragDropEffects operationResult, IDragInfo dragInfo)
    {
        GongSolutions.Wpf.DragDrop.DragDrop.DefaultDragHandler.DragDropOperationFinished(operationResult, dragInfo);
        Trace.TraceInformation("DragDropOperationFinished()");
    }

    public void Dropped(IDropInfo dropInfo)
    {
        GongSolutions.Wpf.DragDrop.DragDrop.DefaultDragHandler.Dropped(dropInfo);
        Trace.TraceInformation("Dropped()");

        var istrings = dragList.Items.Cast<ContentControl>().Select(dd => dd.Content?.ToString());
        Trace.TraceInformation(String.Join(", ", istrings));

    }

    public void StartDrag(IDragInfo dragInfo) => GongSolutions.Wpf.DragDrop.DragDrop.DefaultDragHandler.StartDrag(dragInfo);

    public bool TryCatchOccurredException(Exception exception) => GongSolutions.Wpf.DragDrop.DragDrop.DefaultDragHandler.TryCatchOccurredException(exception);
}